package main

import (
	"fmt"
	"reflect"
)

type Base interface {
	f1()
	f2() int
	f3() (int, bool)
	f4(n1 int, n2 int) int
}

type Person struct {
	name string
	age  int
}

func main() {
	something(1)
	something("11")

	something(Person{"ttao", 18})
}

/*
	interface 可以代指任意类型
*/
func something(arg interface{}) {

	fmt.Println(arg, reflect.TypeOf(arg))

	person, isSuccess := arg.(Person)
	if isSuccess {
		fmt.Println(reflect.TypeOf(arg))
		fmt.Println(person.name, person.age)
	} else {
		fmt.Println("convert error")
	}
}
